home *** CD-ROM | disk | FTP | other *** search
/ TPUG - Toronto PET Users Group / TPUG Users Group CD / TPUG Users Group CD.iso / CRS / crs05.d81 / evsbasic.arc / EVSKEYWORDS.A-D < prev    next >
Text File  |  2009-10-10  |  15KB  |  422 lines

  1. EVS Basic 1.00 Keyword Descriptions
  2. (C) 1988  by  Anton Treuenfels
  3.  
  4. Last Revision:  08/30/88
  5.  
  6. This document describes the EVS Basic keywords and what they do.  Each
  7. description also includes a few examples of the use of the keyword
  8. (although these examples appear as they would in program mode, all keywords
  9. also function in immediate mode).
  10.  
  11. Most EVS Basic keywords require one or more parameters.  The type and
  12. number of parameters are indicated between angle brackets after the keyword
  13. itself:  keyword <parameter>.  Many EVS Basic keywords also accept optional
  14. parameters, which are indicated by square brackets surrounding the angle
  15. brackets:  [<optional>].  Ellipses within square brackets mean that the
  16. entire enclosed block of parameters may be repeated as often as desired:
  17. [[<optional>]...].  When an optional parameter of a keyword is used in a
  18. statement there is often also a separator character (usually a comma)
  19. required to distinguish it from any other parameters:  <required> [,
  20. <optional>] or [<optional>,] <required>.
  21.  
  22. A few keywords have a series of "semi-optional" parameters:  [ <optional>
  23. [, <optional> [, <optional>]]].  Such series usually indicate that at least
  24. one but not necessarily all of the <optional> parameters be present.  With
  25. a series of optional parameters it is possible to "skip over" any the
  26. programmer does not wish to use by just using the separator character to
  27. indicate an unused parameter:  <optional>, , , <optional>.  The separator
  28. character is required between used and unused optional parameters only up
  29. to the last one actually present.  The separator character is not required
  30. or accepted beyond that point.
  31.  
  32. ---------------------------------------
  33.  
  34. BIN$(<hex$>)
  35.  
  36. The BIN$() function combines pairs of ASCII Hex characters from <hex$> to
  37. produce an equivalent binary string.  If <hex$> has an odd number of
  38. characters, BIN$() will ignore the last character.
  39.  
  40. The sixteen ASCII Hex characters are "0" to "9" and "A" to "F".  Each ASCII
  41. Hex character represents half of a binary character, so two are needed for
  42. each character in the finished binary string (thus a character pattern for
  43. IMAGE requires sixteen ASCII Hex characters, and a sprite image requires
  44. 126).  The first character of each pair is taken as the "left" or "upper"
  45. half of a binary character, while the second is taken as the "right" or
  46. "lower" half (from a more technical point of view, the first character
  47. represents the "high nybble" and the second character the "low nybble" of
  48. eight-bit bytes).
  49.  
  50. The binary patterns represented by each ASCII Hex char are listed below:
  51.  
  52. ASCII Hex      Pattern:
  53.  
  54. "0"          0  0  0  0
  55. "1"          0  0  0  1
  56. "2"          0  0  1  0
  57. "3"          0  0  1  1
  58. "4"          0  1  0  0
  59. "5"          0  1  0  1
  60. "6"          0  1  1  0
  61.  
  62.  
  63.  
  64.  
  65.  
  66.  
  67. "7"          0  1  1  1
  68. "8"          1  0  0  0
  69. "9"          1  0  0  1
  70. "A"          1  0  1  0
  71. "B"          1  0  1  1
  72. "C"          1  1  0  0
  73. "D"          1  1  0  1
  74. "E"          1  1  1  0
  75. "F"          1  1  1  1
  76.  
  77. Examples:
  78.  
  79. 10 A$= BIN$(B$)
  80. 20 IMAGE "T", BIN$("3C42A581A599423C"): REM HAPPY FACE
  81. 30 FOR I=0 TO 15: READ A$: IMAGE I, BIN$(A$): NEXT
  82.  
  83. ---------------------------------------
  84.  
  85. CAT [<pattern$>] [, <dvc#>]
  86.  
  87. The CAT command is used to display all or part of the directory of a diskette.
  88. The CAT keyword by itself lists the entire directory of the diskette in the
  89. default disk device (normally device 8) to the screen.
  90.  
  91. <Pattern$> can be used to list only filenames containing that pattern.  The
  92. wildcard characters "?" and "*" can be used in the pattern and have their normal
  93. meaning.
  94.  
  95. <Dvc#> may be used to select any particular disk device, including the default
  96. device.  A directory is normally taken from drive 0, but if the device is dual
  97. drive either drive may be specified by using the first two characters of
  98. <pattern$>:  "0:" (for drive 0) or "1:" (for drive 1).
  99.  
  100. Examples:
  101.  
  102. 10 CAT
  103. 20 CAT "TEST"
  104. 30 CAT , 8
  105. 40 CAT "1:", 9
  106.  
  107. ---------------------------------------
  108.  
  109. CUR(<nexp>)
  110.  
  111. This function returns a value indicating the cursor X- or Y-position or the
  112. value "under" the cursor.  The sign of <nexp> determines the type of value
  113. returned by CUR().  If zero, CUR() returns the physical (not logical) X-position
  114. of the cursor.  If positive, CUR() returns the physical (not logical) Y-position
  115. of the cursor.  If negative, CUR() "looks under" the cursor and returns either
  116. the screen code of the character (if in a text mode) or the pen value of the
  117. pixel (if in a bitmap mode) found there.
  118.  
  119. Examples:
  120.  
  121. 10 X = CUR(0): Y = CUR(1)
  122. 20 LINE CUR(0) + 5, CUR(1) - 10
  123. 30 IF CUR(-1) = 3 THEN EXIT
  124.  
  125. ---------------------------------------
  126.  
  127.  
  128.  
  129.  
  130.  
  131.  
  132.  
  133. DIR [<pattern$>] [, <dvc#>]
  134.  
  135. The DIR command is used to display all or part of the directory of a
  136. diskette.  The DIR keyword by itself lists the entire directory of the
  137. diskette in the default disk device (normally device 8) to the screen.
  138.  
  139. <Pattern$> can be used to list only filenames which begin with the pattern.
  140. The wildcard characters "?" and "*" can be used in the pattern and have
  141. their normal meaning.  Alternatively, filetypes instead of filenames can be
  142. matched using a "*=<filetype>" pattern.
  143.  
  144. <Dvc#> may be used to select any particular disk device, including the
  145. default device.  A directory is normally taken from drive 0, but if the
  146. device is dual drive either drive may be specified by using the first two
  147. characters of <pattern$>:  "0:" (for drive 0) or "1:" (for drive 1).
  148.  
  149. Examples:
  150.  
  151. 10 DIR
  152. 20 DIR "B?N?N?"
  153. 30 DIR , 8
  154. 40 DIR "*=PRG"
  155.  
  156. ---------------------------------------
  157.  
  158. DO [WHILE/UNTIL <exp>]
  159.  
  160. The DO statement marks the start of a DO/LOOP repeat structure.  The DO
  161. statement is physically the first statement of the loop.  Every DO must
  162. have one, and only one, matching LOOP statement.
  163.  
  164. The basic DO/LOOP structure is unconditional, and all program statements
  165. between a DO statement and a LOOP statement will repeatedly execute in
  166. order forever (or until the program is halted by the STOP key).  This is
  167. useful in some cases, but more often a program exits from a DO/LOOP when
  168. some condition is fulfilled.
  169.  
  170. A DO statement may optionally be followed by either the WHILE or UNTIL
  171. conditional statements.  A WHILE conditional will continue repeating the
  172. loop only so long as <exp> is true.  An UNTIL conditional will continue
  173. repeating the loop only so long as <exp> is false.  Note that since either
  174. condition is evaluated before the first program statement contained within
  175. the loop is executed, it is possible to create a loop which may never
  176. actually be executed.
  177.  
  178. When a DO/LOOP is terminated by WHILE, UNTIL, or EXIT, normal program
  179. execution continues starting with the next statement after the LOOP
  180. matching the DO.
  181.  
  182. DO/LOOPs may be nested within each other or within FOR/NEXT loops, and
  183. FOR/NEXT loops may be nested within DO/LOOPs.  The total number of active
  184. nested loops of both kinds should not exceed nine.
  185.  
  186. Examples:
  187.  
  188. 10 DO: PRINT "HELLO": LOOP
  189. 20 DO UNTIL A<0: READ A: PRINT A: LOOP
  190.  
  191. ---------------------------------------
  192.  
  193.  
  194.  
  195.  
  196.  
  197.  
  198.  
  199. DOS <command$> [, <dvc#>]
  200.  
  201. The DOS statement sends a <command$> to the command channel of a disk
  202. device.  The <command$> may be any legal disk command that in V2 Basic
  203. would normally be PRINTed to channel 15 (the disk command channel).  The
  204. most common uses for this statement are initializing a drive, formatting a
  205. diskette, and scratching unneeded files.  Less often used commands include
  206. validating a disk, renaming a file, copying a file, and direct disk access.
  207. See Chapter 4 of the "1541 User's Manual" for details of the various disk
  208. commands.
  209.  
  210. <Dvc#> may be used to select any particular disk device, including the
  211. default device.
  212.  
  213. Examples:
  214.  
  215. 10 DOS "I0"
  216. 20 DOS "S0:TEST*"
  217. 30 DOS "N0:MYDISK,MD",8
  218.  
  219. ---------------------------------------
  220.  
  221. DRAW <shape$> [[;][<shape$>]...]
  222.  
  223. The DRAW statement "draws" a figure defined by a <shape$> on a bitmap
  224. screen.  In general a <shape$> can be drawn much more quickly and is more
  225. easily relocated about the screen than an equivalent shape drawn with LINE
  226. statements.  On the other hand, it is usually not as easy to create a
  227. <shape$> as it is to simply list points to be connected by LINE.
  228.  
  229. DRAW interprets a <shape$> as a coded list of graphics commands.  Commands
  230. are included to move the cursor, plot points, draw lines, paint an area,
  231. change the pen, and expand or contract the shape in the X- or Y-directions.
  232. Each command is two, four, or six characters long and is of the general
  233. form:
  234.  
  235. CHR$(128) + CHR$(command) [+ param$]
  236.  
  237. By default DRAW draws a <shape$> at the current cursor position using the
  238. current pen in the current size.  After a <shape$> is drawn the cursor,
  239. pen, and size are left as last set by the <shape$> definition.  The first
  240. <shape$> definition can optionally be followed by as many more <shape$>
  241. definitions as will fit on a program line.
  242.  
  243. The 17 commands recognized by DRAW are described below.  Unrecognized
  244. commands generate an "?UNKNOWN CHAR" error.
  245.  
  246. The following six commands require coordinate parameters:
  247.  
  248. Move cursor:   "m"+X$+Y$ or "M"+X$+Y$
  249. Plot point:    "d"+X$+Y$ or "D"+X$+Y$
  250. Draw line:     "l"+X$+Y$ or "L"+X$+Y$
  251.  
  252. DRAW interprets the coordinates specified in the above commands as being
  253. relative to the current cursor position rather than absolute, so they may
  254. be either positive or negative values.  Also, DRAW uses only the physical
  255. coordinate system of the bitmap screen (0,0 is the upper left hand corner
  256. and 319,199 the lower right), so that positive X is right, negative X is
  257. left, positive Y is down, and negative Y is up.  The use of relative
  258. coordinates enables a shape to be drawn anywhere on the screen.
  259.  
  260.  
  261.  
  262.  
  263.  
  264.  
  265.  
  266. The difference between the lowercase and uppercase forms of each command is
  267. the allowed range of coordinates, and thus the overall number of characters
  268. needed to specify that range.  The lowercase forms allow X and Y values in
  269. the range -127 to +127 and require two characters, while the uppercase
  270. forms may range from -319 to +319 for X and -199 to +199 for Y and require
  271. four characters.  Note that since the cursor is not allowed to move outside
  272. the physical screen range the maximum range values may not always be
  273. available.
  274.  
  275. The parameter characters needed for the lowercase forms of the above
  276. commands can be created in several steps.  First, the numeric value of each
  277. character is calculated using the following function:
  278.  
  279. DEF FN LC(C)= C - 256 * (C<0)
  280.  
  281. This function is valid for the range -127 to +127.  Given X and Y in this
  282. range, the two characters necessary to the lowercase form can be created:
  283.  
  284. X$ = CHR$(FN RP(X))
  285. Y$ = CHR$(FN RP(Y))
  286.  
  287. A similar method can be employed for the uppercase forms of the commands.
  288. First, functions to create the numeric value:
  289.  
  290. DEF FN UL(C)= (C - 65536 * (C<0)) AND 255
  291. DEF FN UH(C)= (C - 65536 * (C<0)) / 256
  292.  
  293. These functions are valid for the range -32767 to +32767, which is far more
  294. than needed.  The characters themselves can be formed like this:
  295.  
  296. X$ = CHR$(FN UL(X)) + CHR$(FN UH(X))
  297. Y$ = CHR$(FN UL(Y)) + CHR$(FN UH(Y))
  298.  
  299. A complete move, point, or line command thus looks like:
  300.  
  301. CHR$(128) + command$ + X$ + Y$
  302.  
  303. where <command$> is "m", "M", "d", "D", "l" or "L".
  304.  
  305. The only other DRAW command that requires parameters is the paint command:
  306.  
  307. Paint area:   "p"+T$+B$ or "P"+T$+B$
  308.  
  309. The lowercase paint is a threshold paint in the range 0-63 or 128-191, and
  310. T$=CHR$(threshold).
  311.  
  312. The uppercase paint is a pattern paint, and T$ represents the character to
  313. use as the pattern.
  314.  
  315. In either case B$ is the boundary of the filled area.  The boundary value
  316. can be a particular pixel value in the range 0-3 or it may be 255 to stop
  317. the fill at any non-zero pixel, and B$=CHR$(boundary).
  318.  
  319. A complete paint command thus looks like:
  320.  
  321. CHR$(128) + command$ + T$ + B$
  322.  
  323. where <command$> is "p" or "P".
  324.  
  325.  
  326.  
  327.  
  328.  
  329.  
  330.  
  331. The following DRAW commands change the current pen:
  332.  
  333. Set pen 0:    CTRL-Z or CHR$(26)
  334. Set pen 1:    CTRL-X or CHR$(24)
  335. Set pen 2:     CTRL-C or CHR$(3)
  336. Set pen 3:    CTRL-V or CHR$(22)
  337. Set pen 4:     CTRL-B or CHR$(2)
  338.  
  339. The following DRAW commands change the current size of the shape:
  340.  
  341. Normal X-size:   F1 or CHR$(133)
  342. Double X-size:   F2 or CHR$(137)
  343. Normal Y-size:   F3 or CHR$(134)
  344. Double Y-size:   F4 or CHR$(138)
  345.  
  346. Both of the above sets of commands require no parameters and have the form:
  347.  
  348. CHR$(128) + command$
  349.  
  350. where <command$> is one of the CHR$() values shown.
  351.  
  352. All DRAW commands are required to begin with CHR$(128) followed by a legal
  353. command character.  There is one exception to this rule:  a command which
  354. does not start with CHR$(128) is assumed to be an "l" command, that is, a
  355. line command in the range -127 to +127.  In this case the "l" character
  356. does not have to be specified either, so only the two coordinate parameter
  357. characters are needed.
  358.  
  359. Examples:
  360.  
  361. 10 DRAW A$
  362. 20 DRAW A$(I)
  363. 30 DRAW CHR$(128)+CHR$(137);A$
  364.  
  365. ---------------------------------------
  366.  
  367. DS and DS$
  368.  
  369. DS and DS$ are pseudo-variables relating to the error status of a disk
  370. device.  They may be used in any way normal variables are except that they
  371. cannot be assigned values.  Instead, each time DS$ is referenced it will
  372. return the current status message of the most recently used disk device.
  373. DS always returns the number of the last message retrieved by DS$.
  374.  
  375. A disk status message has the general form "error number, error message,
  376. track, sector".  After a successfully executed disk command DS$ will return
  377. the string "00,OK,00,00" and DS will have the value 0.  See Appendix B of
  378. the "1541 User's Manual" for complete descriptions of other error messages
  379. and their causes.
  380.  
  381. Note that the value of DS never changes except when DS$ changes.  This can
  382. be useful if an error occurs when a disk drive attempts to execute a
  383. command (the activity light begins to blink).  Only the very next reference
  384. to DS$ will return the correct error message.  After that the error is
  385. "cleared" (the activity light stops blinking) and any new reference to DS$
  386. will return the "OK" message.  DS, on the other hand, will return the
  387. number associated with the now-cleared error until the next reference to
  388. DS$.
  389.  
  390. Examples:
  391.  
  392.  
  393.  
  394.  
  395.  
  396.  
  397.  
  398. 10 PRINT "DISK STATUS "; DS$
  399. 20 A$ = DS$
  400. 30 IF DS > 0 AND DS <> 50 THEN 9000
  401.  
  402. ---------------------------------------
  403.  
  404. DVC <nexp>
  405.  
  406. The DVC statement sets the default mass-storage device number.  If a
  407. command requires a device number and none is explicitly specified, then the
  408. command is directed to the default device.  The default device can be the
  409. tape drive or any of the disk drives.  EVS Basic uses device 8 (the first
  410. disk drive) as the default device until changed by DVC.
  411.  
  412. LOAD, SAVE, and VERIFY do not care what the default device is, but CAT,
  413. DIR, and DOS will signal an "?ILLEGAL DEVICE ERROR" if they are directed to
  414. the tape drive.
  415.  
  416. Examples:
  417.  
  418. 10 DVC 1
  419. 20 DVC 10
  420. 20 DVC IO(A)
  421.  
  422.